package com.mangowang.module.main.adapter;

import android.content.Context;
import android.graphics.Color;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.proto.Mystock;
import com.mangowang.module.main.R;

import java.util.List;

public class AllocPartnerAdapter extends BaseQuickAdapter<Mystock.get_transfer_mb_list.List, BaseViewHolder> {
    public AllocPartnerAdapter(Context context, List<Mystock.get_transfer_mb_list.List> dataList) {
        super(R.layout.item_alloca_partner, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.get_transfer_mb_list.List item) {
        helper.setText(R.id.tv_name, item.getMemberName())
                .setText(R.id.tv_phone, item.getMemberMobile());
        if (item.getMemberMobile().equals("1")) {
            helper.getView(R.id.tv_phone).setVisibility(View.INVISIBLE);
        } else {
            helper.getView(R.id.tv_phone).setVisibility(View.VISIBLE);
        }
        if (item.getIsAgentPolicy().equals("1")) {
            helper.setVisible(R.id.tv_no_zhen, false)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#192944"))
                    .setTextColor(R.id.tv_phone, Color.parseColor("#192944"));
        } else {
            helper.setVisible(R.id.tv_no_zhen, true)
                    .setVisible(R.id.iv_next, false)
                    .setTextColor(R.id.tv_name, Color.parseColor("#ffb7c0cf"))
                    .setTextColor(R.id.tv_phone, Color.parseColor("#ffb7c0cf"));
        }
    }
}